package com.rmi;
/**
 * HelloClient.java
 * 	An rmi user which calls Hello remote interface methods
 * @author Yoon Kyung Koo (yoonforh@moon.daewoo.co.kr)
 * @version 1.0 1999/05/09
 */
import java.rmi.*;

class HelloClient {
	public static void main(String args[]) {
		try {
			Hello obj = null;
			// if hostname specified
			if (args.length > 1)
				obj=(Hello) Naming.lookup("//"+args[0]+"/HelloServer");
			// no hostname then assume localhost
			else
				obj=(Hello) Naming.lookup("/HelloServer");
			System.out.println("HelloServer said \""
				+obj.hello()+'"');
		} catch (Exception e) {
			System.err.println("Error:"+e.getMessage());
			e.printStackTrace();
		}
	}
}

